//
//  DoAlbumCell.m
//  DoImagePickerController
//
//  Created by Donobono on 2014. 1. 23..
//

#import "DoAlbumCell.h"
#import "DoImagePickerController.h"

@interface DoAlbumCell ()
{
    UILabel *_lbAlbumName;
    UILabel *_lbCount;
}

@end

@implementation DoAlbumCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _lbAlbumName = [[UILabel alloc]initWithFrame:CGRectMake(0,14,254,21)];
        _lbAlbumName.textAlignment = NSTextAlignmentRight;
        _lbAlbumName.lineBreakMode = NSLineBreakByTruncatingTail;
        _lbAlbumName.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;
        _lbAlbumName.adjustsFontSizeToFitWidth = NO;
        _lbAlbumName.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
        _lbAlbumName.font = [UIFont fontWithName:@"Avenir-Medium" size:16];
        _lbAlbumName.textColor = [UIColor colorWithRed:0.941 green:0.725 blue:0.403 alpha:1];
        [self.contentView addSubview:_lbAlbumName];
        
        _lbCount = [[UILabel alloc]initWithFrame:CGRectMake(262,15,58,21)];
        _lbCount.lineBreakMode = NSLineBreakByTruncatingTail;
        _lbCount.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;
        _lbCount.adjustsFontSizeToFitWidth = NO;
        _lbCount.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
        _lbCount.font = [UIFont fontWithName:@"Avenir-Light" size:15];
        _lbCount.textColor = [UIColor colorWithRed:0.969 green:0.784 blue:0.557 alpha:1];
        [self.contentView addSubview:_lbCount];
    }
    return self;
}

- (void)dealloc
{
    [_lbAlbumName release_mm];
    [_lbCount release_mm];
    superdealloc_mm;
}

- (void)setLbAlbumNameText:(NSString *)lbAlbumNameText
{
    _lbAlbumName.text = lbAlbumNameText;
}

- (NSString*)lbAlbumNameText
{
    return _lbAlbumName.text;
}

- (void)setLbCountText:(NSString *)lbCountText
{
    _lbCount.text = lbCountText;
}

- (NSString*)lbCountText
{
    return _lbCount.text;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    if (selected)
    {
        _lbAlbumName.textColor  = [UIColor whiteColor];
        _lbCount.textColor      = [UIColor whiteColor];
        
        self.contentView.backgroundColor = DO_ALBUM_NAME_TEXT_COLOR;
    }
    else
    {
        _lbAlbumName.textColor  = DO_ALBUM_NAME_TEXT_COLOR;
        _lbCount.textColor      = DO_ALBUM_COUNT_TEXT_COLOR;
        
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
}

+ (CGFloat)caleHeight
{
    return 50;
}

@end
